﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DaliUsbDemo.DaliHelper.Dt8Colour
{
    public enum QueryColourValue
    {
        xCoordinate = 0,
        yCoordinate = 1,
        ColourTemperatureTc = 2,
        PrimaryNDimlevel0 = 3,
        PrimaryNDimlevel1 = 4,
        PrimaryNDimlevel2 = 5,
        PrimaryNDimlevel3 = 6,
        PrimaryNDimlevel4 = 7,
        PrimaryNDimlevel5 = 8,
        RedDimlevel = 9,
        GreenDimlevel = 10,
        BlueDimlevel = 11,
        WhiteDimlevel = 12,
        AmberDimlevel = 13,
        FreecolourDimlevel = 14,
        RGBWAFControl = 15,
        xCoordinatePrimaryN0 = 64,
        yCoordinatePrimaryN0 = 65,
        TYPrimaryN0 = 66,
        xCoordinatePrimaryN1 = 67,
        yCoordinatePrimaryN1 = 68,
        TYPrimaryN1 = 69,
        xCoordinatePrimaryN2 = 70,
        yCoordinatePrimaryN2 = 71,
        TYPrimaryN2 = 72,
        xCoordinatePrimaryN3 = 73,
        yCoordinatePrimaryN3 = 74,
        TYPrimaryN3 = 75,
        xCoordinatePrimaryN4 = 76,
        yCoordinatePrimaryN4 = 77,
        TYPrimaryN4 = 78,
        xCoordinatePrimaryN5 = 79,
        yCoordinatePrimaryN5 = 80,
        TYPrimaryN5 = 81,
        NumberOfPrimaries = 82,
        // The following are new added in Part 209ED2.0 AMD.
        powerRatio = 83,
        deRatingFactor = 84,
        enabledChannels = 85,
        ColourTemperatureTcCoolest = 128,
        ColourTemperatureTcPhysicalCoolest = 129,
        ColourTemperatureTcWarmest = 130,
        ColourTemperatureTcPhysicalWarmest = 131,
        ColourTemperatureTcStepIncrement = 132,
        TemporaryxCoordinate = 192,
        TemporaryyCoordinate = 193,
        TemporaryColourTemperatureTc = 194,
        TemporaryPrimaryNDimlevel0 = 195,
        TemporaryPrimaryNDimlevel1 = 196,
        TemporaryPrimaryNDimlevel2 = 197,
        TemporaryPrimaryNDimlevel3 = 198,
        TemporaryPrimaryNDimlevel4 = 199,
        TemporaryPrimaryNDimlevel5 = 200,
        TemporaryRedDimlevel = 201,
        TemporaryGreenDimlevel = 202,
        TemporaryBlueDimlevel = 203,
        TemporaryWhiteDimlevel = 204,
        TemporaryAmberDimlevel = 205,
        TemporaryFreecolourDimlevel = 206,
        TemporaryRGBWAFControl = 207,
        TemporaryColourType = 208,
        ReportxCoordinate = 224,
        ReportyCoordinate = 225,
        ReportColourTemperatureTc = 226,
        ReportPrimaryNDimlevel0 = 227,
        ReportPrimaryNDimlevel1 = 228,
        ReportPrimaryNDimlevel2 = 229,
        ReportPrimaryNDimlevel3 = 230,
        ReportPrimaryNDimlevel4 = 231,
        ReportPrimaryNDimlevel5 = 232,
        ReportRedDimlevel = 233,
        ReportGreenDimlevel = 234,
        ReportBlueDimlevel = 235,
        ReportWhiteDimlevel = 236,
        ReportAmberDimlevel = 237,
        ReportFreecolourDimlevel = 238,
        ReportRGBWAFControl = 239,
        ReportColourType = 240,

        // The following ReportXxxLightOutput query colour value are new added in Part 209ED2.0 AMD.
        ReportRedLightoutput = 241,
        ReportGreenLightoutput = 242,
        ReportBlueLightoutput = 243,
        ReportWhiteLightoutput = 244,
        ReportAmberLightoutput = 245,
        ReportFreecolourLightoutput = 246,
  }

    public static class QueryColourValueExtentsions
    {
    public static int GetByteLength(this QueryColourValue colourValue)
    {
      switch (colourValue)
      {
        case QueryColourValue.TemporaryAmberDimlevel:
        case QueryColourValue.TemporaryBlueDimlevel:
        case QueryColourValue.TemporaryFreecolourDimlevel:
        case QueryColourValue.TemporaryGreenDimlevel:
        case QueryColourValue.TemporaryWhiteDimlevel:
        case QueryColourValue.TemporaryRedDimlevel:
        case QueryColourValue.ReportAmberDimlevel:
        case QueryColourValue.ReportBlueDimlevel:
        case QueryColourValue.ReportFreecolourDimlevel:
        case QueryColourValue.ReportGreenDimlevel:
        case QueryColourValue.ReportWhiteDimlevel:
        case QueryColourValue.ReportRedDimlevel:
        case QueryColourValue.AmberDimlevel:
        case QueryColourValue.BlueDimlevel:
        case QueryColourValue.FreecolourDimlevel:
        case QueryColourValue.GreenDimlevel:
        case QueryColourValue.WhiteDimlevel:
        case QueryColourValue.RedDimlevel:
        case QueryColourValue.TemporaryRGBWAFControl:
        case QueryColourValue.ReportRGBWAFControl:
        case QueryColourValue.RGBWAFControl:
        case QueryColourValue.TemporaryColourType:
        case QueryColourValue.ReportColourType:
        case QueryColourValue.powerRatio:
        case QueryColourValue.deRatingFactor:
        case QueryColourValue.enabledChannels:
        case QueryColourValue.ReportRedLightoutput:
        case QueryColourValue.ReportGreenLightoutput:
        case QueryColourValue.ReportBlueLightoutput:
        case QueryColourValue.ReportWhiteLightoutput:
        case QueryColourValue.ReportAmberLightoutput:
        case QueryColourValue.ReportFreecolourLightoutput:
          return 1;
        default:
          return 2;
      }
    }
  }
}
